<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>

    </head>
    <body>
        
        <form id="myForm" action="" method="post">
            名字<input type="text" name="name" value="sky"> <br> <br>
            密码<input type="password" name="password" value="12345"> <br><br>
            <input id="file" type="file" name="file"><br><br>
            <input type="button" value="提交" onclick="f()">
        </form>
        <script>
            
            
            let formStr=$("form").serialize(); //胜过你写一大片拼接的代码; 程序员动脑的地方要勤快, 只动手的地方要懒惰;
            console.log(typeof formStr);
            console.log(formStr);
            let url = "index/userInfo?" + formStr;
            console.log("url: " + url);
        </script>
        
        
    </body>
</html>
